import request from "@/utils/request";
import store from "@/store/index";

// 夹带k_token
function addK_Token(data) {
    var token = {
        k_token: store.getters.k_token
    };
    Object.assign(data, token);
    return data;
}

/**
 * 获取当前所在的学期
 */
export function getSemester(data) {
    return request({
        url: "/semesterUrl/api/v1/mobile/schedule/semester/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 获取当前自订学年
 */
export function getPersonSemester(data) {
    return request({
        url: "/semesterUrl/api/v1/person/semester/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 获取周列表
 */
export function getWeekList(data) {
    return request({
        url: "/semesterUrl/api/v1/mobile/semester/week/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 获取自订周列表
 */
export function getPersonWeekList(data) {
    return request({
        url: "/semesterUrl/api/v1/person/semester/week/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 查询课表详情(ScheduleWeek)
 */
export function getScheduleWeekInfo(data) {
    return request({
        url: "/semesterUrl/api/v1/mobile/schedule/week/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 查询自订课表详情
 */
export function getPersonScheduleWeekInfo(data) {
    return request({
        url: "/semesterUrl/api/v1/person/schedule/week/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 日志课程(StuScheduleCourse)获取
 */
export function getStuScheduleCourse(data) {
    return request({
        url: "/semesterUrl/api/v1/person/schedule/course/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 获取时间段信息(lessonTime)
 */
export function getLessonTime(data) {
    return request({
        url: "/semesterUrl/api/v1/mobile/time/lesson/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 获取自订时间段信息(lessonTime)
 */
export function getPersonLessonTime(data) {
    return request({
        url: "/semesterUrl/api/v1/person/time/lesson/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 获取用户某周的签到情况(signWeek)
 */
export function getSignWeek(data) {
    return request({
        url: "/semesterUrl/api/v1/mobile/sign/course/week/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 用户签到信息(CourseSign)添加
 */
export function toCourseSign(data) {
    return request({
        url: "/semesterUrl/api/v1/mobile/sign/course/save",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 学生周日程课表关联信息(StuScheduleWeek)主键删除
 */
export function toWeekDelete(data) {
    return request({
        url: "/semesterUrl/api/v1/person/schedule/week/delete/" + data.unid,
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 学生学期(StuSemester)添加与修改
 */
export function toSaveStuSemester(data) {
    return request({
        url: "/semesterUrl/api/v1/person/semester/save",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 分页查询学生学期(StuSemester)分页列表
 */
export function toGetStuSemester(data) {
    return request({
        url: "/semesterUrl/api/v1/person/semester/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 分页查询学生时间套(StuTime)分页列表
 */
export function getStuTime(data) {
    return request({
        url: "/semesterUrl/api/v1/person/time/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 学生时间套(StuTime)添加与修改
 */
export function toSaveStuTime(data) {
    return request({
        url: "/semesterUrl/api/v1/person/time/save",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 分页查询学生时间段(StuTimeLesson)分页列表
 */
export function getStuTimeLesson(data) {
    return request({
        url: "/semesterUrl/api/v1/person/time/lesson/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 学生时间段(StuTimeLesson)添加与修改
 */
export function toSaveStuTimeLesson(data) {
    return request({
        url: "/semesterUrl/api/v1/person/time/lesson/save",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 学生时间段(StuTimeLesson)主键删除
 */
export function toDelStuTimeLesson(data) {
    return request({
        url: "/semesterUrl/api/v1/person/time/lesson/delete/" + data.unid,
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 分页查询学生日程(StuSchedule)分页列表
 */
export function getStuSchedule(data) {
    return request({
        url: "/semesterUrl/api/v1/person/schedule/infos",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 * 学生日程(StuSchedule)添加与修改
 */
export function tiSaveStuSchedule(data) {
    return request({
        url: "/semesterUrl/api/v1/person/schedule/save",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 *日志课程(StuScheduleCourse)添加
 */
export function saveStuScheduleCourse(data) {
    return request({
        url: "/semesterUrl/api/v1/person/schedule/course/save",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 *日志课程(StuScheduleCourse)主键删除
 */
export function delStuScheduleCourse(data) {
    return request({
        url: "/semesterUrl/api/v1/person/schedule/course/delete/" + data.unid,
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}

/**
 *学生周日程课表(StuScheduleWeek)添加
 */
export function saveStuScheduleWeek(data) {
    return request({
        url: "/semesterUrl/api/v1/person/schedule/week/save",
        method: "POST",
        headers: {},
        data: addK_Token(data)
    });
}
